<%@page import="java.util.List"%>
<%@page import="com.carrental.service.CarListService"%>
<%@page import="com.carrental.entity.CarList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>汽车租赁网</title>
<link rel="stylesheet" type="text/css" href="/CarRental/css/common.css" />
<style>
	*{
		margin: 0;
		padding: 0;
	}
	
	html,body{
		width: 100%;
		height: 100%;
		background-color: #f2f2f2;
	}
	
	.head{
		width: 100%;
		height: 50px;
		line-height: 50px;
		background-color: #FA8258;
		color: #ffffff;
	}
	.head-content{
		width: 900px;
		margin: auto;
	}
	.head-content h2{
		float: left;
		margin-right: 10px;
	}
	.head-content a{
		float: left;
		margin-right: 10px;
	}
	.main{
		width: 100%;
	}
	.main-content{
		padding: 20px;
		width: 900px;
		margin: auto;
	}
	
	
	.car{
		width: 100%;
		height: 100px;
		margin-top: 20px;
		border: 1px solid #bebebe;
		background-color: #ffffff;
		padding: 0px 20px;
	}
	.model-title{
		display: inline-block;
		width: 50px;
	}
	.model-text {
		display: inline-block;
		line-height: 100px;
		width: 150px;
		font-size: 30px;
	}
	.number-title{
		display: inline-block;
		width: 50px;
	}
	.number-text{
		display: inline-block;
		line-height: 100px;
		width: 80px;
		font-size: 30px;
	}
	.price-title{
		display: inline-block;
		width: 120px;
	}
	.price-text{
		display: inline-block;
		line-height: 100px;
		width: 200px;
		font-size: 30px;
	}
	.select-button{
		width: 100px;
		height: 30px;
	}
</style>
</head>
<body>
	<div class="head">
		<div class="head-content">
			<h2>汽车租赁网</h2>
			<a href="carRentalList.jsp">我的订单</a>
			<a href="userUpdate.jsp">个人信息</a>
			<a href="LogoutServlet">退出</a>
		</div>
	</div>
	<div class="main">
		<div class="main-content">
			<%
				CarListService carListService = new CarListService();
				List<CarList> carLists = carListService.selectHaveNumber();
				for (CarList carList : carLists) {
					out.print("<div class='car'>");
					out.print("<span class='model-title'>车型</span><span class='model-text'>" + carList.getModel() + "</span>");
					out.print("<span class='number-title'>库存</span><span class='number-text'>" + carList.getNumber() + "</span>");
					out.print("<span class='price-title'>单价（元/日）</span><span class='price-text'>" + carList.getPrice() + "</span>");
					out.print("<a href='carRentalSelectNumAndDate.jsp?id=" + carList.getId() + "&num=1'><button class='select-button'>选择</button></a>");
					out.print("</div>");
				}
			%>
		</div>
	</div>
</body>
</html>